<?php

declare (strict_types=1);
namespace App\Model;

use App\Constants\RecommendedGradeCode;
use Hyperf\DbConnection\Model\Model;
/**
 */
class UserScore extends Model
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'user_score';
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = ['user_id','type_id','type'];
    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = [];

    public static function getInfoByUserId($userId)
    {
        return self::where('user_id',$userId)->first() ?? false;
    }

    public static function getTypeIdByUserId($userId)
    {
        return self::where('user_id',$userId)->first() ?? false;
    }

    public static function getManualDataByType()
    {
        return self::where('type',RecommendedGradeCode::FIX_OPERATE)->get()->toArray() ?? false;
    }
}